<?php
/*
	File created by : Michael 2014-02-26
*/
?>

<script>

	function cancel(){
		window.close();
	}
	function cetak(){
		$('#printarea').siblings().addClass("no_print");
		$('#printarea').parents().siblings().addClass("no_print");
		window.print();
		//$('#printarea').siblings().removeClass("no_print");
		//$('#printarea').parents().removeClass("no_print");
	}
</script>

<div style="border-bottom:2px solid #000;padding-bottom:5px;margin-bottom:20px">
<?php 
	$this->widget('application.components.widgets.ActionBar', 
		array("menuAlign" => "right", 
			'items' => array(
				array(
					'id' => "btnPrint",
					'title' => "Cetak",
					'icon' => "images/action/Actions-print-icon.png",
					'callback'=>"cetak"
				),					
				array(
					'id' => "btnCancel",
					'title' => "Batal",
					'icon' => "images/action/Actions-dialog-cancel-icon.png",
					'callback'=>"cancel"
				),
			)
		)
	);
?>
</div>
<div id="printarea" align="center"  >

<?php 
if(count($data)>0){
	echo "<table '>";
	echo "<tr><th>Nama</th><th>Mulai</th><th>Akhir</th><th>Keterangan</th><th>Status</th></tr>";
	foreach($data as $row){
		$status='Aktif';
		if($row['is_active']==0) $status="Non Aktif";
		$start_date = date('d-M-Y', strtotime($row['start_date']));
		$end_date = date('d-M-Y', strtotime($row['end_date']));
		echo "<tr>";
		echo "<td>".$row['name']."</td><td>".$start_date."</td><td>".$end_date."</td><td>".$row['description']."</td><td>".$status."</td>";
		echo "</tr>";
	}
	echo "</table>";
}
?>
</div>
<script>
$('#printarea table,td,th').css({ 'border': '1px solid black' });
$('#printarea table').css({ 'border-collapse':'collapse' });
$('#printarea table td,th').css({ 'padding':'5px' });
</script>